package it.abc.sicsic.view.backing.spese;

import it.abc.sicsic.JavaServiceFacade;
import it.abc.sicsic.model.skipper.Skipper;

import it.abc.sicsic.model.spese.Spese;

import it.abc.sicsic.view.util.ViewUtil;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import javax.faces.event.ActionEvent;

import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichInputText;

//import org.apache.log4j.Logger;

@ManagedBean(name = "backing_gestioneSpese")
@SessionScoped

public class GestioneSpese {
    private RichInputText itData;
    private RichInputText itBarca;
    private RichInputText itImportoSpese;
    private RichTable tableSpese;
   //private static final Logger logger = Logger.getLogger(GestioneSpese.class);
    
    public void cerca(ActionEvent actionEvent) {
        //logger.info("cerca started");
        System.out.println("cerca started");
        JavaServiceFacade serviceFacade = new JavaServiceFacade();
        //logger.info("faced istantiated");
        System.out.println("faced istantiated");
        List<Spese> list = null;
        //list = serviceFacade.getSpese(getData(), getBarca());
        list = serviceFacade.getSpeseFindAllMonth();
        //logger.info("spese =" + list);
        System.out.println("spese =" + list);
        tableSpese.setValue(list);
       
    }

    private String getData(){
        return ViewUtil.getStringValue(getItData());
    }
    
    private String getBarca(){
        return ViewUtil.getStringValue(getItBarca());
    }
    
    private String getImportoSpese(){
        return ViewUtil.getStringValue(getItImportoSpese());
    }
    
    public GestioneSpese() {
        System.out.println("GestioneSpese");   
    }

    public void setItData(RichInputText itData) {
        this.itData = itData;
    }

    public RichInputText getItData() {
        return itData;
    }

    public void setItBarca(RichInputText itBarca) {
        this.itBarca = itBarca;
    }

    public RichInputText getItBarca() {
        return itBarca;
    }

    public void setTableSpese(RichTable tableSpese) {
        this.tableSpese = tableSpese;
    }

    public RichTable getTableSpese() {
        return tableSpese;
    }

    public void setItImportoSpese(RichInputText itImportoSpese) {
        this.itImportoSpese = itImportoSpese;
    }

    public RichInputText getItImportoSpese() {
        return itImportoSpese;
    }
}
